class Splitter
    
    def self.method_missing(method_name)
        method_array = method_name.to_s.split("_")
        if method_array.include? "vertically"
            $table_name = method_array[1..(method_array.index("vertically")-1)].join("_")
            $split_columnname = method_array[(method_array.index("at")+1)..(method_array.length-1)].join("_")
            $split_rowposition = nil
        elsif method_array.include? "horizontally"
            $table_name = method_array[1..(method_array.index("horizontally")-1)].join("_")  
            $split_columnname = nil
            $split_rowposition = method_array.last
        end    
        return Splitter.new
    end
    
    def under connection
        if !$split_columnname.nil?
            puts $split_columnname
            puts $table_name
        elsif !$split_rowposition.nil?  
            connection.query("create table #{$table_name}_new_tab as (select * from questions limit #{$split_rowposition.to_i})")
            puts "table was sucessfully splitted"
        end  
    end

end